package top.hongthorn.controller;

import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import top.hongthorn.pojo.AircraftCarrier;
import top.hongthorn.pojo.User;
import top.hongthorn.service.AircraftCarrierService;
import top.hongthorn.util.Result;
import java.util.Map;

/**
 * <p>
 * 航母主表 前端控制器
 * </p>
 *
 * @author 泓宇网络科技工作室
 * @since 2023-12-28 00:45:56
 */
@RestController
@RequestMapping("/aircraftCarrier")
@Api(value = "AircraftCarrierController", tags = "AircraftCarrierController")
public class AircraftCarrierController {


    @Autowired
    private AircraftCarrierService aircraftCarrierService;


    @ApiOperation(value = "删除舷号")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "舷号id", dataType = "Integer", paramType = "query", required = true)
    })
    @RequestMapping(value = "/deleteById", method = RequestMethod.GET)
    public Result deleteById(Integer id) {
        return aircraftCarrierService.deleteById(id);
    }

    @ApiOperation(value = "修改舷号信息")
    @RequestMapping(value = "/updateAircraftCarrier", method = RequestMethod.POST)
    public Result updateAircraftCarrier(@ApiParam AircraftCarrier aircraftCarrier) {
        return aircraftCarrierService.updateAircraftCarrier(aircraftCarrier);
    }

    @ApiOperation(value = "添加舷号信息")
    @RequestMapping(value = "/addAircraftCarrier", method = RequestMethod.POST)
    public Result addAircraftCarrier(@ApiParam AircraftCarrier aircraftCarrier) {
        return aircraftCarrierService.addAircraftCarrier(aircraftCarrier);
    }

    @ApiOperation(value = "舷号数据分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "页码", dataType = "Integer", example = "1", required = false),
            @ApiImplicitParam(name = "limit", value = "显示条数", dataType = "Integer", example = "3", required = false),
    })
    @RequestMapping(value = "/findAircraftCarrier", method = RequestMethod.GET)
    public Map findAircraftCarrier(Integer page, Integer limit) {
        return aircraftCarrierService.findAircraftCarrier(page, limit);
    }
}